00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _OV_FILE_H_
00019 #define _OV_FILE_H_
00020
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif
00025
00026 #include <stdio.h>
00027 #include "codec.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 typedef struct {
00040 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
00041 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
00042 int (*close_func) (void *datasource);
00043 long (*tell_func) (void *datasource);
00044 } ov_callbacks;
00045
00046 #define NOTOPEN 0
00047 #define PARTOPEN 1
00048 #define OPENED 2
00049 #define STREAMSET 3
00050 #define INITSET 4
00051
00052 typedef struct OggVorbis_File {
00053 void *datasource;
00054 int seekable;
00055 ogg_int64_t offset;
00056 ogg_int64_t end;
00057 ogg_sync_state oy;
00058
00059
00060
00061 int links;
00062 ogg_int64_t *offsets;
00063 ogg_int64_t *dataoffsets;
00064 long *serialnos;
00065 ogg_int64_t *pcmlengths;
00066 vorbis_info *vi;
00067 vorbis_comment *vc;
00068
00069
00070 ogg_int64_t pcm_offset;
00071 int ready_state;
00072 long current_serialno;
00073 int current_link;
00074
00075 double bittrack;
00076 double samptrack;
00077
00078 ogg_stream_state os;
00079
00080 vorbis_dsp_state vd;
00081 vorbis_block vb;
00082
00083 ov_callbacks callbacks;
00084
00085 } OggVorbis_File;
00086
00087 extern int ov_clear(OggVorbis_File *vf);
00088 extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
00089 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
00090 char *initial, long ibytes, ov_callbacks callbacks);
00091
00092 extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
00093 extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
00094 char *initial, long ibytes, ov_callbacks callbacks);
00095 extern int ov_test_open(OggVorbis_File *vf);
00096
00097 extern long ov_bitrate(OggVorbis_File *vf,int i);
00098 extern long ov_bitrate_instant(OggVorbis_File *vf);
00099 extern long ov_streams(OggVorbis_File *vf);
00100 extern long ov_seekable(OggVorbis_File *vf);
00101 extern long ov_serialnumber(OggVorbis_File *vf,int i);
00102
00103 extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
00104 extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
00105 extern double ov_time_total(OggVorbis_File *vf,int i);
00106
00107 extern int ov_raw_seek(OggVorbis_File *vf,long pos);
00108 extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
00109 extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
00110 extern int ov_time_seek(OggVorbis_File *vf,double pos);
00111 extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
00112
00113 extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
00114 extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
00115 extern double ov_time_tell(OggVorbis_File *vf);
00116
00117 extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
00118 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
00119
00120 extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
00121 int bigendianp,int word,int sgned,int *bitstream);
00122
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126
00127 #endif
00128
00129